<table class="table table-striped goods_list_table   table-bordered">
    <thead>
        <tr>
          <th class="opth50"><label>
          <input type="checkbox"  id="alldel" value="" > <span class="lbl"></span>
          </label></th>  
        	<th class="opth100">商品编号</th>
            <th class="opth100">商品名</th>
            <th class="opth70">类型</th>
            <th class="opth70">添加时间</th>
            <th class="opth70">操作人</th>
            <th class="opth70">操作</th>
        </tr>
    </thead>
    <tbody id="tbodylist">
        <volist name="_datalist['lists']" id="g">
            <tr>
                 <td><input
                      type="checkbox" class="ace"  value="{$g.id}" > <span class="lbl"></span>
                  </td> 
                <td>{$g['goods_sn']}</td>
            	<td>{$g['goods_name']}</td>
                <td>{$g['blongtype'] ==Presell?'预售':'团购'}</td>
                <td>{$g['addtime']}</td>
                <td>{$g['user_name']}</td>
                <td>
                <a href="delete_wx_presale?id={$g['id']}" class="btn btn-sm btn-primary" onclick="Javascript:return confirm('确定要删除吗？');">删除</a>
                </td>
            </tr>
        </volist>
    </tbody>
</table>
<button class='btn btn-danger' onclick="batch_set_user(0)">批量删除</button>
<notempty name="_datalist['lists']">
  <div class="page_list_ops dataTables_paginate paging_bootstrap pagination">
    {$_datalist['page_html']}
 </div> 

</notempty>

<script type="text/javascript">
//设置后 获取到当前页
 var page = $('.optd').children('i').eq(1).html();
 var list_url = "{:U('presaleList')}?p="+page;
   $(function(){
    debugger;
           $("#alldel").bind("click",checkSel);
    })

     function checkSel(){
       var flg= $(this).is(":checked");
       $("input[type='checkbox']").prop("checked",flg);
    }




//批量设置会员有效无效
function batch_set_user(state){
     //获取需要删除信息
     var _val=selallval();
     if(_val==""){
         alert("请勾选需要删除的记录!");
         return false;
     }
     debugger;
     $.ajax({
             'url': "{:U('all_delete_wx_presale')}",
             'data': {'allid':_val},
             'dataType': 'json',
             'type': 'POST',
             success: function (data) {
                 if (data.staute =="success") {  
                    alert(data.msg);
                      _load_html_byurl(list_url, "load_tb_div");
                 }

             }, error: function (err) { 

                 art.dialog({title:'温馨提示',content: err.responseText, ok: function () {this.close();return false;},okval:'确定'});
             },complete: function () {
                
             }
         });

}


var selallval=function(){
     var _list="";
     $("input[type='checkbox']:checked").each(function(){
         // var flg=$(this).is(":checked");
         //if(!flg)return false;
         var _val=$(this).val();
         if(_val!=""){
         _list+= (_list==""?"":",")+"'"+_val+"'";
         } 
     });
     return _list;
} 
</script>